<!--
*Author：COCO
 *代码由框架生成,任何更改都可能导致被代码生成器覆盖
 *业务请在@/extension/production/production/Production_ReportWorkOrder.js此处编写
 -->
<template>
    <view-grid ref="grid"
               :columns="columns"
               :detail="detail"
               :editFormFields="editFormFields"
               :editFormOptions="editFormOptions"
               :searchFormFields="searchFormFields"
               :searchFormOptions="searchFormOptions"
               :table="table"
               :extend="extend">
    </view-grid>
</template>
<script>
    import extend from "@/extension/production/production/Production_ReportWorkOrder.js";
    import { ref, defineComponent } from "vue";
    export default defineComponent({
        setup() {
            const table = ref({
                key: 'ReportWorkOrder_Id',
                footer: "Foots",
                cnName: '报工',
                name: 'production/Production_ReportWorkOrder',
                url: "/Production_ReportWorkOrder/",
                sortName: "CreateDate"
            });
            const editFormFields = ref({"WorkOrder_Id":"","Process_Id":"","Product_Id":"","ProductCode":"","ProductName":"","ProductStandard":"","MachineId":"","ProductUser":"","ReportQty":"","Unit_Id":"","GoodQty":"","NoGoodQty":"","ProcessProgress":"","StartDate":"","EndDate":""});
            const editFormOptions = ref([[{"dataKey":"workOrderList","data":[],"title":"工单","required":true,"field":"WorkOrder_Id","type":"select"},
                               {"dataKey":"process","data":[],"title":"工序名称","required":true,"field":"Process_Id","type":"select"},
                               {"dataKey":"productList","data":[],"title":"产品","required":true,"field":"Product_Id","disabled":true,"type":"select"}],
                              [{"title":"产品编号","required":true,"field":"ProductCode","disabled":true,"type":"text"},
                               {"title":"产品名称","required":true,"field":"ProductName","disabled":true,"type":"text"},
                               {"title":"产品规格","field":"ProductStandard","disabled":true,"type":"text"}],
                              [{"title":"报工数","field":"ReportQty","type":"number"},
                               {"dataKey":"users","data":[],"title":"生产人员","required":true,"field":"ProductUser","type":"select"},
                               {"dataKey":"MachineList","data":[],"title":"设备名称","field":"MachineId","type":"select"}],
                              [{"dataKey":"unitList","data":[],"title":"单位","field":"Unit_Id","type":"select"},
                               {"title":"良品数","field":"GoodQty","type":"number"},
                               {"title":"不良品数","field":"NoGoodQty","type":"number"}],
                              [{"title":"工序进度","field":"ProcessProgress","disabled":true,"type":"text"},
                               {"title":"开始时间","field":"StartDate","type":"datetime"},
                               {"title":"结束时间","field":"EndDate","type":"datetime"}]]);
            const searchFormFields = ref({"WorkOrder_Id":"","Process_Id":"","ProductCode":"","ProductName":"","ProductUser":"","ReportQty":"","Unit_Id":"","GoodQty":"","StartDate":"","EndDate":""});
            const searchFormOptions = ref([[{"dataKey":"process","data":[],"title":"工序名称","field":"Process_Id","type":"select"},{"title":"产品编号","field":"ProductCode","type":"like"},{"title":"产品名称","field":"ProductName","type":"like"}],[{"dataKey":"workOrderList","data":[],"title":"工单","field":"WorkOrder_Id","type":"select"},{"dataKey":"users","data":[],"title":"生产人员","field":"ProductUser","type":"select"},{"title":"报工数","field":"ReportQty","type":"number"}],[{"dataKey":"unitList","data":[],"title":"单位","field":"Unit_Id","type":"select"},{"title":"良品数","field":"GoodQty","type":"text"},{"title":"开始时间","field":"StartDate","type":"date"}],[{"title":"结束时间","field":"EndDate","type":"date"}]]);
            const columns = ref([{field:'ReportWorkOrder_Id',title:'报工主键ID',type:'int',width:110,hidden:true,readonly:true,require:true,align:'left'},
                       {field:'WorkChildCode',title:'工单明细编码',type:'string',width:220,require:true,align:'left',sort:true},
                       {field:'WorkOrder_Id',title:'工单',type:'string',bind:{ key:'workOrderList',data:[]},width:260,hidden:true,require:true,align:'left'},
                       {field:'Process_Id',title:'工序名称',type:'int',bind:{ key:'process',data:[]},width:140,require:true,align:'left'},
                       {field:'Product_Id',title:'产品',type:'int',bind:{ key:'productList',data:[]},width:140,readonly:true,require:true,align:'left'},
                       {field:'ProductCode',title:'产品编号',type:'string',width:250,readonly:true,require:true,align:'left'},
                       {field:'ProductName',title:'产品名称',type:'string',width:180,readonly:true,require:true,align:'left'},
                       {field:'ProductStandard',title:'产品规格',type:'string',width:180,readonly:true,align:'left'},
                       {field:'MachineId',title:'设备名称',type:'string',bind:{ key:'MachineList',data:[]},width:120,align:'left'},
                       {field:'ProcessStatus',title:'工序状态',type:'string',width:180,hidden:true,align:'left'},
                       {field:'ProductUser',title:'生产人员',type:'string',bind:{ key:'users',data:[]},width:180,require:true,align:'left'},
                       {field:'ReportQty',title:'报工数',type:'int',width:110,align:'left'},
                       {field:'Unit_Id',title:'单位',type:'int',bind:{ key:'unitList',data:[]},width:110,align:'left'},
                       {field:'GoodQty',title:'良品数',type:'int',width:110,align:'left'},
                       {field:'ScrapQty',title:'报废数',type:'int',width:80,align:'left'},
                       {field:'NoGoodQty',title:'不良品数',type:'int',width:110,align:'left'},
                       {field:'ProcessProgress',title:'工序进度',type:'string',width:180,readonly:true,align:'left'},
                       {field:'StartDate',title:'开始时间',type:'datetime',width:170,align:'left',sort:true},
                       {field:'EndDate',title:'结束时间',type:'datetime',width:170,align:'left',sort:true},
                       {field:'ReoportDurationHour',title:'报工时长',type:'int',width:110,hidden:true,align:'left'},
                       {field:'ReoportDurationMinute',title:'ReoportDurationMinute',type:'int',width:110,hidden:true,align:'left'},
                       {field:'StandardProgress',title:'标准效率',type:'string',width:180,hidden:true,align:'left'},
                       {field:'ActualProgress',title:'实际效率',type:'string',width:180,hidden:true,align:'left'},
                       {field:'RateStandard',title:'达标率',type:'string',width:180,hidden:true,readonly:true,align:'left'},
                       {field:'PriceType',title:'计价方式',type:'int',bind:{ key:'PriceType',data:[]},width:110,hidden:true,align:'left'},
                       {field:'UnitPrice',title:'工资单价',type:'decimal',width:110,hidden:true,align:'left'},
                       {field:'GuessPrice',title:'预计工资',type:'decimal',width:110,hidden:true,align:'left'},
                       {field:'ApproveStatus',title:'审批状态',type:'int',bind:{ key:'ApproveStatus',data:[]},width:110,align:'left'},
                       {field:'ApproveUser',title:'审批人',type:'string',width:180,readonly:true,align:'left'},
                       {field:'ReportTime',title:'报工时间',type:'datetime',width:200,align:'left',sort:true},
                       {field:'CreateDate',title:'创建时间',type:'datetime',width:200,align:'left',sort:true},
                       {field:'CreateID',title:'创建人编号',type:'int',width:80,hidden:true,align:'left'},
                       {field:'Creator',title:'创建人',type:'string',width:130,align:'left'},
                       {field:'Modifier',title:'修改人',type:'string',width:130,align:'left'},
                       {field:'ModifyDate',title:'修改时间',type:'datetime',width:200,align:'left',sort:true},
                       {field:'ModifyID',title:'修改人编号',type:'int',width:80,hidden:true,align:'left'}]);
            const detail = ref({
                cnName: "#detailCnName",
                table: "#detailTable",
                columns: [],
                sortName: "",
                key: ""
            });
            return {
                table,
                extend,
                editFormFields,
                editFormOptions,
                searchFormFields,
                searchFormOptions,
                columns,
                detail,
            };
        },
    });
</script>
